<?php

namespace Modules\Shop\Database\factories;

use Arr;
use Illuminate\Database\Eloquent\Factories\Factory;

/**
 * 评论
 * @package Modules\Shop\Database\factories
 */
class CommentFactory extends Factory
{
    protected $model = \Modules\Shop\Entities\Comment::class;

    public function definition()
    {
        return [
            'site_id' => 1,
            'user_id' => mt_rand(1, 5),
            'goods_id' => 1,
            'comment_id' => Arr::random([1, null]),
            'images' => $this->images(),
            'content' => $this->faker->paragraph()
        ];
    }

    protected function images()
    {
        $images = [];
        for ($i = 0; $i < 3; $i++) {
            array_push($images, "https://hdcms-dev.oss-cn-hangzhou.aliyuncs.com/images/b" . mt_rand(1, 110) . ".jpg");
        }
        return $images;
    }
}
